package com.service.impl;

import com.jfinal.plugin.activerecord.Page;
import com.model.YsUser;
import com.service.UserService;

/**
 * YsUserService provider端的实现类
 *
 * @author: lbq
 * @email: 526509994@qq.com
 * @date: 17/4/11
 */
public class UserServiceImpl implements UserService {

	public YsUser save(YsUser YsUser) {
		if (YsUser == null) {
			return null;
		}
		YsUser.save();
		return YsUser;
	}

	public void update(YsUser YsUser) {
		if (YsUser == null) {
			return;
		}
		YsUser.update();
	}

	public Page<YsUser> paginate(int pageNumber, int pageSize) {
		return YsUser.dao.paginate(pageNumber, pageSize, "select *", "from ys_user order by id asc");
	}

	@Override
	public void deleteById(Long id) {
		YsUser.dao.deleteById(id);
	}

	@Override
	public YsUser findById(Long id) {
		return YsUser.dao.findById(id);
	}

}
